package com.example.backend.mapper;

import com.example.backend.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * 用户表操作接口
 */
@Component
@Mapper
public interface UserMapper {
    //用户登录查询
    @Select("select * from users where username=#{username} and password=#{password}")
    User userLogin(@Param("username") String username, @Param("password") String password);

    //注册用户
    @Insert("insert into users (userId,userName,password,sex,age,phone) values (#{userId},#{userName},#{password},#{sex},#{age},#{phone})")
    int insertUser(@Param("userId") int userId,@Param("userName") String userName,@Param("password") String password,@Param("sex") int sex,@Param("age") int age,@Param("phone") String phone);
}
